<template>
	<div class="game-container report-container">
		<div class="view-container dealer-container">
			<div class="params">
				<el-form ref="form" :inline="true" :model="queryData">
					<el-form-item label="月份:" prop="searchTime">
						<el-date-picker
							v-model="searchTime"
							type="monthrange"
							:picker-options="thisMonthOptions"
							range-separator="-"
							:clearable="false"
							:start-placeholder="
								$t('funds.fund_audit.start_month_placeholder')
							"
							:end-placeholder="
								$t('funds.fund_audit.end_month_placeholder')
							"
						></el-date-picker>
					</el-form-item>

					<el-form-item label="总代账号:" prop="proxyAccount">
						<el-input
							v-model="queryData.proxyAccount"
							size="medium"
							placeholder="请输入代理账号"
							clearable
							style="width: 180px"
							maxlength="11"
						></el-input>
					</el-form-item>
					<el-form-item label="总代类型:">
						<el-select
							v-model="queryData.accountTypes"
							size="medium"
							:placeholder="$t('common.select_all')"
							clearable
							multiple
							collapse-tags
							style="width: 220px"
						>
							<el-option
								v-for="item in accountTypeArr"
								:key="item.code"
								:label="item.description"
								:value="item.code"
							></el-option>
						</el-select>
					</el-form-item>

					<el-form-item label="冲正后净盈亏:">
						<el-input-number
							v-model="queryData.rushAmountMin"
							size="medium"
							:placeholder="$t('common.minimum')"
							style="width: 130px"
							:min="-9999999999"
							:max="9999999999"
							:controls="false"
							name="rushAmountMin"
							@blur="checkValue($event)"
						></el-input-number>
						-
						<el-input-number
							v-model="queryData.rushAmountMax"
							size="medium"
							:placeholder="$t('common.maximum')"
							style="width: 130px"
							:min="-9999999999"
							:max="9999999999"
							:controls="false"
							name="rushAmountMax"
							@blur="checkValue($event)"
						></el-input-number>
					</el-form-item>
					<el-form-item label="平台分润:">
						<el-input-number
							v-model="queryData.platFeeMin"
							size="medium"
							:placeholder="$t('common.minimum')"
							style="width: 130px"
							:min="-9999999999"
							:max="9999999999"
							:controls="false"
							name="platFeeMin"
							@blur="checkValue($event)"
						></el-input-number>
						-
						<el-input-number
							v-model="queryData.platFeeMax"
							size="medium"
							:placeholder="$t('common.maximum')"
							style="width: 130px"
							:min="-9999999999"
							:max="9999999999"
							:controls="false"
							name="platFeeMax"
							@blur="checkValue($event)"
						></el-input-number>
					</el-form-item>

					<el-form-item>
						<el-button
							type="primary"
							icon="el-icon-search"
							size="medium"
							@click="search"
						>
							查询
						</el-button>
						<el-button
							icon="el-icon-refresh-left"
							size="medium"
							@click="reset"
						>
							重置
						</el-button>
						<el-button
							v-if="hasPermission('1030512')"
							type="warning"
							icon="el-icon-folder-add"
							size="medium"
							:disabled="loading"
							@click="exportExcel"
						>
							导出
						</el-button>
					</el-form-item>
				</el-form>
			</div>

			<div class="content">
				<el-table
					v-loading="loading"
					element-loading-spinner="el-icon-loading"
					border
					class="small-size-table"
					:data="dataList"
					style="width: 100%"
					show-summary
					:summary-method="getSummaries"
					:header-cell-style="getRowClass"
					@sort-change="_changeTableSort"
				>
					<el-table-column
						prop="reportYm"
						align="center"
						:label="$t('funds.fund_audit.month')"
						width="120px"
					>
						<template slot-scope="scope">
							{{ formatDateMonth(scope.row.reportYm) }}
						</template>
					</el-table-column>
					<el-table-column
						prop="proxyName"
						align="center"
						:label="$t('funds.fund_audit.top_proxy_name')"
						width="120px"
					>
						<template slot-scope="scope">
							{{ scope.row.proxyName }}
						</template>
					</el-table-column>
					<el-table-column
						prop="accountType"
						align="center"
						label="总代类型"
						width="120px"
					>
						<template slot-scope="scope">
							{{
								typeFilter(scope.row.accountType, 'accountType')
							}}
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						:label="$t('common.account_status')"
						width="120"
					>
						<template slot-scope="scope">
							<span
								v-if="scope.row.loginLockStatus === 1"
								class="disableRgba"
							>
								{{ $t('common.login_lock_status') }}
							</span>
							<span
								v-if="scope.row.accountLockStatus === 1"
								class="deleteRgba"
							>
								{{ $t('common.account_lock_status') }}
							</span>
							<span
								v-if="
									scope.row.loginLockStatus === 0 &&
										scope.row.accountLockStatus === 0
								"
								class="normalRgba"
							>
								{{ $t('common.account_status_normal') }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="platFee"
						align="center"
						label="平台分润"
						width="130px"
					>
						<template slot-scope="scope">
							<span>
								{{ decimalToFixed2(scope.row.platFee) }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						prop="platRate"
						align="center"
						label="分润比例"
						width="130px"
					>
						<template slot-scope="scope">
							<el-link
								type="primary"
								@click="openRatioDialog(scope.row)"
							>
								{{ handlePercentage(scope.row.platRate) }}
							</el-link>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="adjustRushAmount"
						align="center"
						label="冲正后净盈亏"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="
									getNumberValColor(
										scope.row.adjustRushAmount
									)
								"
							>
								{{
									decimalToFixed2(scope.row.adjustRushAmount)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="lastMonthAmount"
						align="center"
						:label="$t('funds.fund_audit.last_month_the_balance')"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="
									getNumberValColor(scope.row.lastMonthAmount)
								"
							>
								{{ decimalToFixed2(scope.row.lastMonthAmount) }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="netAmount"
						align="center"
						label="会员投注盈亏"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="getNumberValColor(scope.row.netAmount)"
							>
								{{ decimalToFixed2(scope.row.netAmount) }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="returnWaterAmount"
						align="center"
						:label="$t('funds.fund_audit.total_return_water')"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="
									getNumberValColor(
										scope.row.returnWaterAmount
									)
								"
							>
								{{
									decimalToFixed2(scope.row.returnWaterAmount)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="discountAmount"
						align="center"
						:label="$t('funds.fund_audit.total_discount')"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="
									getNumberValColor(scope.row.discountAmount)
								"
							>
								{{ decimalToFixed2(scope.row.discountAmount) }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="otherAdjustAmount"
						align="center"
						:label="$t('funds.fund_audit.other_adjustments')"
						width="130px"
					>
						<template slot-scope="scope">
							<span
								:class="
									getNumberValColor(
										scope.row.otherAdjustAmount
									)
								"
							>
								{{
									decimalToFixed2(scope.row.otherAdjustAmount)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="memberDepositWithdrawFeeAmount"
						align="center"
						label="会员充提手续费"
						width="160px"
					>
						<template slot-scope="scope">
							<span>
								{{
									decimalToFixed2(
										scope.row.memberDepositWithdrawFeeAmount
									)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="proxyDepositWithdrawFeeAmount"
						align="center"
						label="代理充提手续费"
						width="150px"
					>
						<template slot-scope="scope">
							<span>
								{{
									decimalToFixed2(
										scope.row.proxyDepositWithdrawFeeAmount
									)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="venueAmount"
						align="center"
						:label="$t('funds.fund_audit.venue_cost')"
						width="130px"
					>
						<template slot-scope="scope">
							<span>
								{{ decimalToFixed2(scope.row.venueAmount) }}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="discountBackAmount"
						align="center"
						label="总优惠分摊"
						width="130px"
					>
						<template slot-scope="scope">
							<span>
								{{
									decimalToFixed2(
										scope.row.discountBackAmount
									)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="memberDepositWithdrawFeeBackAmount"
						align="center"
						label="会员充提手续费分摊"
						width="180px"
					>
						<template slot-scope="scope">
							<span>
								{{
									decimalToFixed2(
										scope.row
											.memberDepositWithdrawFeeBackAmount
									)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="proxyDepositWithdrawFeeBackAmount"
						align="center"
						label="代理充提手续费分摊"
						width="180px"
					>
						<template slot-scope="scope">
							<span>
								{{
									decimalToFixed2(
										scope.row
											.proxyDepositWithdrawFeeBackAmount
									)
								}}
							</span>
						</template>
					</el-table-column>
					<el-table-column
						sortable="custom"
						prop="otherBackAmount"
						align="center"
						label="其他调整分摊"
						width="130px"
					>
						<template slot-scope="scope">
							<span>
								{{ decimalToFixed2(scope.row.otherBackAmount) }}
							</span>
						</template>
					</el-table-column>
				</el-table>
				<!-- 分页 -->
				<el-pagination
					class="pageValue"
					:current-page.sync="pageNum"
					background
					layout="total, sizes,prev, pager, next, jumper"
					:page-size="pageSize"
					:page-sizes="pageSizes"
					:total="total"
					@current-change="handleCurrentChange"
					@size-change="handleSizeChange"
				></el-pagination>
			</div>
		</div>
		<el-dialog
			:visible.sync="ratioDialog.visible"
			width="600px"
			title="坐庄分润比例"
		>
			<el-table
				v-loading="ratioDialog.loading"
				element-loading-spinner="el-icon-loading"
				border
				size="mini"
				height="400"
				:data="ratioDialog.data"
				style="width: 100%"
				:header-cell-style="getRowClass"
			>
				<el-table-column
					align="center"
					type="index"
					:label="$t('common.serial_number')"
				>
					<template slot-scope="scope">
						<span
							:class="
								scope.row.profitSharingRatio ===
								ratioDialog.rowRate
									? 'blueColor'
									: ''
							"
						>
							{{ scope.$index + 1 }}
						</span>
					</template>
				</el-table-column>
				<el-table-column
					align="center"
					label="分润比例(%)"
					prop="profitSharingRatio"
				>
					<template slot-scope="scope">
						<span
							:class="
								scope.row.profitSharingRatio ===
								ratioDialog.rowRate
									? 'blueColor'
									: ''
							"
						>
							{{ decimalToMul(scope.row.profitSharingRatio) }}
						</span>
					</template>
				</el-table-column>
				<el-table-column
					align="center"
					label="游戏亏损(元)"
					prop="gameLoss"
				>
					<template slot-scope="scope">
						<span
							:class="
								scope.row.profitSharingRatio ===
								ratioDialog.rowRate
									? 'blueColor'
									: ''
							"
						>
							≥ {{ decimalToFixed2(scope.row.gameLoss) }}
						</span>
					</template>
				</el-table-column>
			</el-table>
		</el-dialog>
	</div>
</template>

<script>
import list from '@/mixins/list'
import dayjs from 'dayjs'

const startTime = dayjs().startOf('month')
const endTime = dayjs().endOf('month')
import { routerNames } from '@/utils/consts'
export default {
	name: routerNames.bankersProfitRecord,
	mixins: [list],
	data() {
		return {
			queryData: {
				proxyAccount: undefined,
				accountTypes: undefined,
				rushAmountMin: undefined,
				rushAmountMax: undefined,
				platFeeMin: undefined,
				platFeeMax: undefined
			},
			searchTime: [startTime, endTime],
			dataList: [],
			summary: {},
			thisMonthOptions: {
				disabledDate: (time) => {
					return time.getTime() > Date.now()
				}
			},
			ratioDialog: {
				visible: false,
				loading: false,
				data: [],
				rowRate: ''
			}
		}
	},
	computed: {
		accountTypeArr() {
			return this.globalDics.accountType
		}
	},
	mounted() {},
	methods: {
		formatDateMonth(date) {
			return date ? dayjs(String(date)).format('YYYY-MM') : '-'
		},
		openRatioDialog(row) {
			this.ratioDialog.loading = true
			this.ratioDialog.rowRate = row.platRate
			this.$api
				.profitPolicyConfigDetailApi({ id: row.holderPolicyTypeId })
				.then((res) => {
					this.ratioDialog.data = res.data || []
					this.ratioDialog.visible = true
					this.ratioDialog.loading = false
				})
				.catch(() => (this.ratioDialog.loading = false))
		},
		loadData() {
			this.loading = true
			const [startMonth, endMonth] = this.searchTime || []
			const params = {
				...this.getParams(this.queryData),
				startMonth: startMonth
					? dayjs(startMonth).format('YYYYMM')
					: '',
				endMonth: endMonth ? dayjs(endMonth).format('YYYYMM') : ''
			}
			this.$api
				.bankersProfitRecordList(params)
				.then((res) => {
					this.dataList = res.data?.record || []
					this.total = res.data?.totalRecord || 0
					this.loading = false
				})
				.catch(() => (this.loading = false))
			this.$api
				.bankersProfitRecordTotal(params)
				.then((res) => {
					this.summary = res.data || {}
					this.loading = false
				})
				.catch(() => (this.loading = false))
		},

		getSummaries(params) {
			const { columns, data } = params
			const obj = {
				平台分润: '平台分润',
				冲正后净盈亏: '冲正后净盈亏',
				上月结余: '上月结余',
				会员投注盈亏: '会员投注盈亏',
				总返水: '总返水',
				总优惠: '总优惠',
				其他调整: '其他调整',
				会员充提手续费: '会员充提手续费',
				代理充提手续费: '代理充提手续费',
				场馆费: '场馆费',
				总优惠分摊: '总优惠分摊',
				会员充提手续费分摊: '会员充提手续费分摊',
				代理充提手续费分摊: '代理充提手续费分摊',
				其他调整分摊: '其他调整分摊'
			}
			const sums = []
			columns.forEach((column, index) => {
				if (index === 0) {
					const el = (
						<div class='count_row'>
							<p>小计</p>
							<p>合计</p>
						</div>
					)
					sums[index] = el
					return
				} else if (this.summary !== null) {
					const values = data.map((item) =>
						Number(item[column.property])
					)
					if (column.label === obj[column.label]) {
						sums[index] = values.reduce((prev, curr) => {
							const value = Number(curr)
							if (!isNaN(value)) {
								return prev + curr
							} else {
								return prev
							}
						}, 0)
						const num = sums[index]
						switch (column.label) {
							case '平台分润':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary.platFee
											)}
										</p>
									</div>
								)
								break
							case '冲正后净盈亏':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.adjustRushAmount
											)}
										>
											{this.filterSummar(
												this.summary.adjustRushAmount
											)}
										</p>
									</div>
								)
								break
							case '上月结余':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.lastMonthAmount
											)}
										>
											{this.filterSummar(
												this.summary.lastMonthAmount
											)}
										</p>
									</div>
								)
								break
							case '会员投注盈亏':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.netAmount
											)}
										>
											{this.filterSummar(
												this.summary.netAmount
											)}
										</p>
									</div>
								)
								break
							case '总返水':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.returnWaterAmount
											)}
										>
											{this.filterSummar(
												this.summary.returnWaterAmount
											)}
										</p>
									</div>
								)
								break
							case '总优惠':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.discountAmount
											)}
										>
											{this.filterSummar(
												this.summary.discountAmount
											)}
										</p>
									</div>
								)
								break
							case '其他调整':
								sums[index] = (
									<div class='count_row'>
										<p class={this.getNumberValColor(num)}>
											{this.filterSummar(num)}
										</p>
										<p
											class={this.getNumberValColor(
												this.summary.otherAdjustAmount
											)}
										>
											{this.filterSummar(
												this.summary.otherAdjustAmount
											)}
										</p>
									</div>
								)
								break
							case '会员充提手续费':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary
													.memberDepositWithdrawFeeAmount
											)}
										</p>
									</div>
								)
								break
							case '代理充提手续费':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary
													.proxyDepositWithdrawFeeAmount
											)}
										</p>
									</div>
								)
								break
							case '场馆费':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary.venueAmount
											)}
										</p>
									</div>
								)
								break
							case '总优惠分摊':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary.discountBackAmount
											)}
										</p>
									</div>
								)
								break
							case '会员充提手续费分摊':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary
													.memberDepositWithdrawFeeBackAmount
											)}
										</p>
									</div>
								)
								break
							case '代理充提手续费分摊':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary
													.proxyDepositWithdrawFeeBackAmount
											)}
										</p>
									</div>
								)
								break
							case '其他调整分摊':
								sums[index] = (
									<div class='count_row'>
										<p>{this.filterSummar(num)}</p>
										<p>
											{this.filterSummar(
												this.summary.otherBackAmount
											)}
										</p>
									</div>
								)
								break
						}
					} else {
						sums[index] = ''
					}
				}
			})
			return sums
		},
		reset() {
			this.pageNum = 1
			this.searchTime = [startTime, endTime]
			this.queryData = {
				proxyAccount: undefined,
				accountType: undefined,
				rushAmountMin: undefined,
				rushAmountMax: undefined,
				platFeeMin: undefined,
				platFeeMax: undefined
			}
			this.loadData()
		},
		_changeTableSort({ column, prop, order }) {
			const obj = {
				platFee: 1,
				adjustRushAmount: 2,
				lastMonthAmount: 3,
				netAmount: 4,
				returnWaterAmount: 5,
				discountAmount: 6,
				otherAdjustAmount: 7,
				memberDepositWithdrawFeeAmount: 8,
				proxyDepositWithdrawFeeAmount: 9,
				venueAmount: 10,
				discountBackAmount: 11,
				memberDepositWithdrawFeeBackAmount: 12,
				proxyDepositWithdrawFeeBackAmount: 13,
				otherBackAmount: 14
			}
			this.queryData.orderKey = obj[prop]
			if (order === 'ascending') {
				// 升序
				this.queryData.orderType = 'asc'
			} else if (column.order === 'descending') {
				// 降序
				this.queryData.orderType = 'desc'
			} else {
				delete this.queryData.orderKey
				delete this.queryData.orderType
			}
			this.loadData()
		},
		checkValue(e) {
			const { name, value } = e.target
			switch (name) {
				case 'rushAmountMin':
					if (value && value * 1 > this.queryData.rushAmountMax * 1) {
						this.$message({
							type: 'warning',
							message: `冲正后净盈亏最小值不能大于最大值`
						})
						this.queryData.rushAmountMin = undefined
					} else if (value !== '') {
						this.queryData.rushAmountMin = value
					} else {
						this.queryData.rushAmountMin = undefined
					}
					break
				case 'rushAmountMax':
					if (value && value * 1 < this.queryData.rushAmountMin * 1) {
						this.$message({
							type: 'warning',
							message: `冲正后净盈亏最大值不能小于最小值`
						})
						this.queryData.rushAmountMax = undefined
					} else if (value !== '') {
						this.queryData.rushAmountMax = value
					} else {
						this.queryData.rushAmountMax = undefined
					}
					break

				case 'platFeeMin':
					if (value && value * 1 > this.queryData.platFeeMax * 1) {
						this.$message({
							type: 'warning',
							message: `平台分润最小值不能大于最大值`
						})
						this.queryData.platFeeMin = undefined
					} else if (value !== '') {
						this.queryData.platFeeMin = value
					} else {
						this.queryData.platFeeMin = undefined
					}
					break
				case 'platFeeMax':
					if (value && value * 1 < this.queryData.platFeeMin * 1) {
						this.$message({
							type: 'warning',
							message: `平台分润最大值不能小于最小值`
						})
						this.queryData.platFeeMax = undefined
					} else if (value !== '') {
						this.queryData.platFeeMax = value
					} else {
						this.queryData.platFeeMax = undefined
					}
					break
			}
		},
		exportExcel() {
			const [startMonth, endMonth] = this.searchTime || []
			const params = {
				...this.getParams(this.queryData),
				startMonth: startMonth
					? dayjs(startMonth).format('YYYYMM')
					: '',
				endMonth: endMonth ? dayjs(endMonth).format('YYYYMM') : ''
			}

			this.$confirm(
				`<strong>${this.$t(
					'common.is_export'
				)}</strong></br><span style='font-size:12px;color:#c1c1c1'>${this.$t(
					'common.excess_data'
				)}</span>`,
				this.$t('common.success_tip'),
				{
					dangerouslyUseHTMLString: true,
					confirmButtonText: this.$t('common.confirm'),
					cancelButtonText: this.$t('common.cancel'),
					type: 'warning'
				}
			)
				.then(() => {
					this.$api
						.bankersProfitRecordExportExcel(params)
						.then((res) => {
							const { data, status } = res
							if (res && status === 200) {
								const { type } = data
								if (type.includes('application/json')) {
									const reader = new FileReader()
									reader.onload = (evt) => {
										if (evt.target.readyState === 2) {
											const {
												target: { result }
											} = evt
											const ret = JSON.parse(result)
											if (ret.code !== 200) {
												this.$message({
													type: 'error',
													message: ret.msg,
													duration: 1500
												})
											}
										}
									}
									reader.readAsText(data)
								} else {
									const result = res.data
									const disposition =
										res.headers['content-disposition']
									const fileNames =
										disposition && disposition.split("''")
									let fileName = fileNames[1]
									fileName = decodeURIComponent(fileName)
									const blob = new Blob([result], {
										type: 'application/octet-stream'
									})
									if (
										'download' in
										document.createElement('a')
									) {
										const downloadLink = document.createElement(
											'a'
										)
										downloadLink.download = fileName || ''
										downloadLink.style.display = 'none'
										downloadLink.href = URL.createObjectURL(
											blob
										)
										document.body.appendChild(downloadLink)
										downloadLink.click()
										URL.revokeObjectURL(downloadLink.href)
										document.body.removeChild(downloadLink)
									} else {
										window.navigator.msSaveBlob(
											blob,
											fileName
										)
									}
									this.$message({
										type: 'success',
										message: this.$t(
											'common.export_success'
										),
										duration: 1500
									})
								}
							}
						})
						.catch(() => {
							this.loading = false
							this.$message({
								type: 'error',
								message: '导出失败',
								duration: 1500
							})
						})
				})
				.catch(() => {})
		},
		getValue(val) {
			return val || val === 0 ? val : '-'
		}
	}
}
</script>

<style lang="scss" scoped>
// 合计样式
.count_row {
	height: 80px;
	p {
		height: 40px;
		line-height: 40px;
		font-weight: 700;
		span {
			display: inline-block;
			width: 20px;
			height: 20px;
		}
	}
}
::v-deep .el-table {
	.high-light {
		color: #0dc5e3;
	}
}
</style>
